import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, IsNumber, IsPhoneNumber, IsString } from 'class-validator';
import { ShareDto } from './share.dto';

export class UsersDto extends ShareDto {
  // validator
  @IsString()
  @IsNotEmpty()
  //swagger
  @ApiProperty({
    description: '用户名',
    example: 'username'
  })
  username: string;

  // validator
  @IsString()
  @IsNotEmpty()
  //swagger
  @ApiProperty({
    description: '密码',
    example: '123456'
  })
  password: string;

  // validator
  @IsString()
  //swagger
  @ApiProperty({
    description: '姓名',
    required: false,
    example: 'name'
  })
  name: string;

  // validator
  @IsEmail()
  //swagger
  @ApiProperty({
    description: '邮箱',
    required: false,
    example: '123123@qq.com'
  })
  email: string

  // validator
  @IsNumber()
  //swagger
  @ApiProperty({
    description: '年龄',
    required: false,
    example: 0
  })
  age: number

  // validator
  @IsString()
  //swagger
  @ApiProperty({
    description: '电话号码',
    required: false,
    example: '176237297463'
  })
  phone: string

  //swagger
  @ApiProperty({
    description: '电话号码',
    required: false,
    example: ''
  })
  appConfig: string
}